package test01;

import com.feri.gpstudy.bo.MedicationAllBo;
import com.feri.gpstudy.bo.NurseAddBo;
import com.feri.gpstudy.entity.Medication;
import com.feri.gpstudy.entity.Nurse;
import com.feri.gpstudy.service.intf.MedicationService;
import com.feri.gpstudy.service.intf.NurseService;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;

import static cn.hutool.core.date.DateTime.now;

public class test01 {
    @Test
    public void test01(){
        //1 获取上下文对象， Bean容器
        ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("spring.xml");
        MedicationService service = context.getBean(MedicationService.class);
        System.out.println(service.save(new Medication(new Date(),34.22,"感冒灵","千锋")));
    }
    @Test
    public void test02(){
        ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("spring.xml");
        MedicationService service = context.getBean(MedicationService.class);
        System.out.println(service.queryAll(new MedicationAllBo()));
    }

    @Test
    public void test03() {
        ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("spring.xml");
        NurseService service = context.getBean(NurseService.class);
        System.out.println(service.queryById(100001));
    }

    @Test
    public void test04() {
        ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("spring.xml");
        NurseService service = context.getBean(NurseService.class);
        System.out.println(service.add(new Nurse(100003,"小爱芬",'女',21,"12737373737","初级护士",now())));
    }

    @Test
    public void test05() {
        ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("spring.xml");
        NurseService service = context.getBean(NurseService.class);
        System.out.println(service.save(new NurseAddBo(100006,"小梦露",'女',21,"13132373737","中级护师")));
    }
}
